//
//  ImportAreaCell.m
//  Utils
//
//  Created by enghou on 2018/6/7.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "ImportAreaCell.h"
#import "ScrollAddImageView.h"
#import "NetPath.h"
@interface ImportAreaCell()

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@property (weak, nonatomic) IBOutlet UILabel *problemLabel;

@property (weak, nonatomic) IBOutlet UILabel *areaTypeLabel;

@property (weak, nonatomic) IBOutlet UILabel *areaLabel;

@property (weak, nonatomic) IBOutlet ScrollAddImageView *filesCollection;

@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *images;

@end

@implementation ImportAreaCell

-(void)setModel:(ImportAreaItemModel *)model{
    _model = model;
    _nameLabel.text = _model.creator;
    _timeLabel.text = _model.time;
    _problemLabel.text = _model.question;
    _areaTypeLabel.text = _model.typeName;
    _areaLabel.text = _model.area;
    if (_model.files.count == 0) {
        [self.images enumerateObjectsUsingBlock:^(UIImageView *obj, NSUInteger idx, BOOL * _Nonnull stop) {
            obj.hidden = YES;
        }];
    }else{
        for (int i = 0; i < _model.files.count; i++) {
            MediaItemModel *m = _model.files[i];
            UIImageView *image = self.images[i];
            image.hidden = NO;
            if (m.type == Image) {
                [image sd_setImageWithURL:m.fileURL];
            }
        }
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
